<template>
  <div>
    <div class="content_1">
      <van-row>
        <van-col span="12"
          ><div>今年</div>
          <p>￥{{ year }}</p>
        </van-col>
        <van-col span="12">
          <div>总收入</div>
          <p>￥{{ total }}</p>
        </van-col>
      </van-row>
      <div class="yoy">
        <span>同比</span>
        <i>{{ contrast }}</i>
      </div>
    </div>
    <div>
      <van-cell title="收入统计" :icon="pic" class="title" />
      <van-cell
        :title="item.year"
        :value="item.income"
        v-for="(item, index) in list"
        :key="index"
      />
    </div>
  </div>
</template>

<script>
import { GetCustIncomeData } from "@/request/api";
export default {
  data() {
    return {
      pic: require("../assets/img/收入统计.png"),
      contrast: "",
      year: "",
      total: "",
      list: [],
    };
  },
  created() {
    GetCustIncomeData(this.$route.query.id).then((res) => {
      console.log(res);
      this.contrast = res.data.datas[0].data.contrast;
      this.year = res.data.datas[0].data.year;
      this.total = res.data.datas[0].data.total;
      this.list = res.data.datas[0].data.list;
    });
  },
};
</script>
 
<style lang = "less" scoped>
.content_1 {
  background-color: #fff;
  padding: 25px 20px;
  border-bottom: 1px solid #ccc;
}
.van-col {
  div {
    font-size: 14px;
    color: #ccc;
    padding-left: 4px;
  }
  p {
    font-size: 20px;
    margin: 0;
    line-height: 30px;
    color: orange;
  }
}
.yoy {
  width: 30%;
  height: 26px;
  line-height: 26px;
  text-align: center;
  background-color: #ccc;
  i {
    color: blue;
    font-weight: 900;
  }
}
.title {
  padding: 20px 0 20px 8px;
}
.van-cell__value {
  color: orange;
}
</style>